function I = grb2gray(img)      
        r=0.2990*img(:,:,1);
        g=0.5870*img(:,:,2); 
        b=0.1140*img(:,:,3); 
        I = cat(2, r+g+b); 